﻿<UserControl
    x:Class="JE.MicroMVVM.Example.Views.MyUserControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:microMvvmNavigation="using:MicroMVVM.Navigation"
    microMvvmNavigation:Navigator.IsEnabled="True"
    mc:Ignorable="d"
    d:DesignHeight="300"
    d:DesignWidth="400">

    <Grid x:Name="TestUserControl" Background="Red" Width="300" Height="200">
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition />
            <RowDefinition />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        
        <TextBlock Grid.Row="0" Grid.ColumnSpan="2" Text="{Binding Test1}" />

        <TextBlock Grid.Row="1" Grid.ColumnSpan="2" Text="{Binding Test2}" />

        <Button Grid.Row="2" Grid.Column="0" Command="{Binding NavigateCommand}" Content="Navigate" />

        <Button Grid.Row="2" Grid.Column="1" Command="{Binding VisualStateCommand}" Content="Visual State" />

        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup x:Name="TestVisualStates">
                <VisualState x:Name="Blue">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="TestUserControl">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="Blue"/>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>

                <VisualState x:Name="Red">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="TestUserControl">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="Red"/>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
    </Grid>
</UserControl>